const usePlmConfigurationStore = defineStore('usePlmConfigurationStore', {
	state: () => ({
		// 枚举相关
		tableData: [],
		tableDataSon: [],
		checkBoxValue: [],
		searchParam: '',
		selPage: 1,
		selSize: 10,
		parentKeys: [],
		parentExtraParams: {},
		parentSelArr: { className: [], classDescription: [], classDependBy: [] },
		sonKeys: [],
		sonExtraParams: {},
		sonSelArr: { enumName: [], description: [], activity: [], dependBy: [], value: [] },
		sonFormClassifyId: '',
		// 非枚举公共模块
		modelClassName: '', //表名
		addFromSomeModelClassName: '', //从***新建窗口的表名
		outsideTableName: '', // 外界表的表名
		outsideTableRowId: '', // 外界表的选中行ID
		templateName: '', //模板表名
		modalClassId: '', // 表的id
		tableDataResponse: [], //表数据
		searchInputParams: [], //输入框绑定值集合
		columVModeloptions: {}, //各个列的筛选项勾选绑定值
		extraParams: {},
		goingToDetail: false, //是否跳转到详情页
		rowToDetailId: '', //跳转到详情页鞋带的当前行id
		lastTabId: '',
		parentTableName: '', // 详情页面列表项新建时需要传递
		isDetail: false, // 是否是详情页,
		cellId: '', // 表格每一行的数据id
		isAttr: false // 页面是否存在属性表格
	}),
	actions: {
		setTableData(data) {
			this.tableData = data
		},
		setTableDataSon(dataSon) {
			this.tableDataSon = dataSon
		},
		setCheckBoxValue(arr) {
			this.checkBoxValue = arr
		},
		setSearchParam(param) {
			this.searchParam = param
		},
		resetPageParam() {
			this.selPage = 1
			this.selSize = 10
		},
		setmodelClassName(data) {
			this.modelClassName = data
		},
		setAddFromSomeModelClassName(data) {
			this.addFromSomeModelClassName = data
		},
		setOutsideTableName(data) {
			this.outsideTableName = data
		},
		setOutsideTableRowId(data) {
			this.outsideTableRowId = data
		},
		setTemplateName(data) {
			this.templateName = data
		},
		setModalClassId(id) {
			this.modalClassId = id
		},
		setTableDataResponse(data) {
			this.tableDataResponse = data
		},
		setColumVModeloptions(data) {
			for (let i = 0; i < data.length; i++) {
				this.columVModeloptions[data[i]] = []
			}
		},
		resetColumVModeloptions() {
			this.columVModeloptions = {}
		},
		setGoingToDetail(data) {
			this.goingToDetail = data
		},
		setRowToDetailId(data) {
			this.rowToDetailId = data
		},
		resetStore() {
			for (const key in this.columVModeloptions) {
				this.columVModeloptions[key] = []
			}
		},
		setCellId(value) {
			this.cellId = value
		},
		setAttr(value) {
			this.isAttr = value
		}
	}
})

export default usePlmConfigurationStore
